package com.yb.bussiness.shoper;

import java.util.List;
import java.util.Map;

import com.yb.base.dao.BaseDao;
import com.yb.base.dao.IBaseDao;
import com.yb.domain.goods.TgGoods;
import com.yb.domain.goods.TgStore;
import com.yb.util.framework.PageUtil;

public class TgStoreServiceImpl implements TgStoreService {

	private IBaseDao<TgStore, Long> dao;

	private String FIND_SQL = "SELECT * FROM T_G_STORE where 1=1 ";

	public TgStoreServiceImpl() {
		dao = new BaseDao<TgStore, Long>(TgStore.class);
	}

	public void delTgStore(Long id) {
		dao.deleteById(id);
	}

	public PageUtil findList(Map<String, String> map, int page, int row) {
		return null;
	}

	public TgStore read(Long id) {
		return dao.read(id);
	}

	public void saveOrUpdate(TgStore obj) {
		if (0 == obj.getId())
			dao.saveEntity(obj);
		else
			dao.update(obj);
	}

	public TgStore findStoreBybid(Long lid) {
		String sql = FIND_SQL + " and brandId=?";
		List<TgStore> list = dao.findList(sql, new Object[] { lid });
		if(null!=list && list.size()>0)
		return list.get(0);
		return null;
	}

}
